package com.lxit.dao;

import com.lxit.pojo.Score;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ScoreMapper {
    @Delete({
        "delete from tb_score",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_score (id, exam_id, ",
        "student_id, subject_sort, ",
        "answer_list, student_answer_list, ",
        "student_score_list, subject_socre_list, ",
        "totalscore)",
        "values (#{id,jdbcType=INTEGER}, #{examId,jdbcType=INTEGER}, ",
        "#{studentId,jdbcType=INTEGER}, #{subjectSort,jdbcType=VARCHAR}, ",
        "#{answerList,jdbcType=VARCHAR}, #{studentAnswerList,jdbcType=VARCHAR}, ",
        "#{studentScoreList,jdbcType=VARCHAR}, #{subjectSocreList,jdbcType=VARCHAR}, ",
        "#{totalscore,jdbcType=INTEGER})"
    })
    int insert(Score record);

    int insertSelective(Score record);

    @Select({
        "select",
        "id, exam_id, student_id, subject_sort, answer_list, student_answer_list, student_score_list, ",
        "subject_socre_list, totalscore",
        "from tb_score",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Score selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Score record);

    @Update({
        "update tb_score",
        "set exam_id = #{examId,jdbcType=INTEGER},",
          "student_id = #{studentId,jdbcType=INTEGER},",
          "subject_sort = #{subjectSort,jdbcType=VARCHAR},",
          "answer_list = #{answerList,jdbcType=VARCHAR},",
          "student_answer_list = #{studentAnswerList,jdbcType=VARCHAR},",
          "student_score_list = #{studentScoreList,jdbcType=VARCHAR},",
          "subject_socre_list = #{subjectSocreList,jdbcType=VARCHAR},",
          "totalscore = #{totalscore,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Score record);
}